//index.js
//获取应用实例
const app = getApp();

Page({
  data: {
    subjects: [],
    curMovie:null
  },
  changeMovie(e){
    const {current,source}=e.detail;
    switch(source){
      case "touch":
        this.setData({
          curMovie: this.data.subjects[current]
        });
      return;
    }
  },
  onLoad: function () {
    let that = this;

    wx.showLoading({
      title: '加载中...',
    })

    const start = 0,
          count = 10;

    return app.dou.getMovies(start, count).then(res => {
      that.setData({
        subjects: res.subjects,
        curMovie:res.subjects[0]
      })
      wx.hideLoading()
    })
  }
})
